package leader.print;

import java.util.List;

import leader.service.DirectTeacherService;
import leader.tool.JTableDefine;
import teacher.bean.Project;
import teacher.bean.Teacher;
import tools.StringDate;

public class ProjectPrint {
	public void printProject(List<Project> lists){
		System.out.println(lists.size());
		DirectTeacherService DT = new DirectTeacherService();
		String[][] columnNames = new String[lists.size()+1][7];		
		columnNames[0] = new String[]{"编号","名称","负责人","项目级别","项目类型","到账经费","开发周期"};
		for(int i=1;i<lists.size()+1;i++) {
			Project project = lists.get(i-1);
			columnNames[i][0] = String.valueOf(i);
			columnNames[i][1] = project.getName();
			Teacher tea = new Teacher();
			tea.setTeaId(project.getTeaId());			
			columnNames[i][2] = DT.selectTeacherById(tea).getName();
			columnNames[i][3] = String.valueOf(project.getLevel());
			columnNames[i][4] = String.valueOf(project.getKind());
			columnNames[i][5] = String.valueOf(project.getArriveFunds());
			StringDate date = new StringDate();
			columnNames[i][6] = date.DateToString(project.getBeginDate())+"至"+date.DateToString(project.getFinishDate());
		}
		int[] px = new int[]{40,120,50,50,60,60,145};
		JTableDefine d = new JTableDefine();
		d.printTable(columnNames,px);
		System.out.println("============================");
	}
}
